package kr.hkit.powerjava.chapter07;

public class StringTest {

	public static void main(String[] args) {

		String str1 = "Hello Java";
		String str2 = "MySQL";
		String str3 = "mysql";

		try {
			char ch = str1.charAt(8);
			System.out.println(ch);

			System.out.println(str1.compareTo(str2) == 0 ? "같음" : str1
					.compareTo(str2));

			System.out.println(str1.concat(" " + str2));

			System.out.println(str1.equals(str2) ? "같음" : "다름");

			System.out.println(str1.equalsIgnoreCase("Hello JAva") ? "같음"
					: "다름");
			System.out.println(str2.equals(str3) ? "같음" : "다름");
			System.out.println(str2.equalsIgnoreCase(str3) ? "같음" : "다름");

			System.out.println(str1.isEmpty());
			System.out.println("".isEmpty());

			System.out.println(str1.length());

			for (int i = 0; i < str1.length(); i++) {
				System.out.print(str1.charAt(i));
			}
			System.out.println();
			System.out.println(str1.replace('l', 'L'));

			System.out.println(str1.substring(6));
			System.out.println(str1.substring(6, 8));
			System.out.println(str1.substring(6, 10).toUpperCase());

		} catch (IndexOutOfBoundsException e) {
			System.out.println("인덱스는 0 ~ " + (str1.length() - 1) + "까지 가능");
		}
	}
}
